home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / include / gtk-2.0 / gtk / gtktextview.h < prev    next >
Encoding:
C/C++ Source or Header  |  2006-04-25  |  17.1 KB  |  366 lines

  1. /* GTK - The GIMP Toolkit
  2.  * gtktextview.h Copyright (C) 2000 Red Hat, Inc.
  3.  *
  4.  * This library is free software; you can redistribute it and/or
  5.  * modify it under the terms of the GNU Lesser General Public
  6.  * License as published by the Free Software Foundation; either
  7.  * version 2 of the License, or (at your option) any later version.
  8.  *
  9.  * This library is distributed in the hope that it will be useful,
  10.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  12.  * Lesser General Public License for more details.
  13.  *
  14.  * You should have received a copy of the GNU Lesser General Public
  15.  * License along with this library; if not, write to the
  16.  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  17.  * Boston, MA 02111-1307, USA.
  18.  */
  19.  
  20. /*
  21.  * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
  22.  * file for a list of people on the GTK+ Team.  See the ChangeLog
  23.  * files for a list of changes.  These files are distributed with
  24.  * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
  25.  */
  26.  
  27. #ifndef __GTK_TEXT_VIEW_H__
  28. #define __GTK_TEXT_VIEW_H__
  29.  
  30. #include <gtk/gtkcontainer.h>
  31. #include <gtk/gtkimcontext.h>
  32. #include <gtk/gtktextbuffer.h>
  33. #include <gtk/gtkmenu.h>
  34.  
  35. G_BEGIN_DECLS
  36.  
  37. #define GTK_TYPE_TEXT_VIEW             (gtk_text_view_get_type ())
  38. #define GTK_TEXT_VIEW(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_TEXT_VIEW, GtkTextView))
  39. #define GTK_TEXT_VIEW_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_TEXT_VIEW, GtkTextViewClass))
  40. #define GTK_IS_TEXT_VIEW(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_TEXT_VIEW))
  41. #define GTK_IS_TEXT_VIEW_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_TEXT_VIEW))
  42. #define GTK_TEXT_VIEW_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_TEXT_VIEW, GtkTextViewClass))
  43.  
  44. typedef enum
  45. {
  46.   GTK_TEXT_WINDOW_PRIVATE,
  47.   GTK_TEXT_WINDOW_WIDGET,
  48.   GTK_TEXT_WINDOW_TEXT,
  49.   GTK_TEXT_WINDOW_LEFT,
  50.   GTK_TEXT_WINDOW_RIGHT,
  51.   GTK_TEXT_WINDOW_TOP,
  52.   GTK_TEXT_WINDOW_BOTTOM
  53. } GtkTextWindowType;
  54.  
  55. #define GTK_TEXT_VIEW_PRIORITY_VALIDATE (GDK_PRIORITY_REDRAW + 5)
  56.  
  57. typedef struct _GtkTextView GtkTextView;
  58. typedef struct _GtkTextViewClass GtkTextViewClass;
  59.  
  60. /* Internal private types. */
  61. typedef struct _GtkTextWindow GtkTextWindow;
  62. typedef struct _GtkTextPendingScroll GtkTextPendingScroll;
  63.  
  64. struct _GtkTextView
  65. {
  66.   GtkContainer parent_instance;
  67.  
  68.   struct _GtkTextLayout *layout;
  69.   GtkTextBuffer *buffer;
  70.  
  71.   guint selection_drag_handler;
  72.   guint scroll_timeout;
  73.  
  74.   /* Default style settings */
  75.   gint pixels_above_lines;
  76.   gint pixels_below_lines;
  77.   gint pixels_inside_wrap;
  78.   GtkWrapMode wrap_mode;  
  79.   GtkJustification justify;
  80.   gint left_margin;
  81.   gint right_margin;
  82.   gint indent;
  83.   PangoTabArray *tabs;
  84.   guint editable : 1;
  85.  
  86.   
  87.   
  88.   guint overwrite_mode : 1;
  89.   guint cursor_visible : 1;
  90.  
  91.   /* if we have reset the IM since the last character entered */  
  92.   guint  need_im_reset : 1;    
  93.  
  94.   guint accepts_tab : 1;
  95.   
  96.   guint width_changed : 1;
  97.   
  98.   /* debug flag - means that we've validated onscreen since the
  99.    * last "invalidate" signal from the layout
  100.    */
  101.   guint onscreen_validated : 1;
  102.  
  103.   guint mouse_cursor_obscured : 1;
  104.  
  105.   GtkTextWindow *text_window;
  106.   GtkTextWindow *left_window;
  107.   GtkTextWindow *right_window;
  108.   GtkTextWindow *top_window;
  109.   GtkTextWindow *bottom_window;
  110.  
  111.   GtkAdjustment *hadjustment;
  112.   GtkAdjustment *vadjustment;
  113.  
  114.   gint xoffset;                 /* Offsets between widget coordinates and buffer coordinates */
  115.   gint yoffset;
  116.   gint width;                   /* Width and height of the buffer */
  117.   gint height;
  118.  
  119.   /* The virtual cursor position is normally the same as the
  120.    * actual (strong) cursor position, except in two circumstances:
  121.    *
  122.    * a) When the cursor is moved vertically with the keyboard
  123.    * b) When the text view is scrolled with the keyboard
  124.    *
  125.    * In case a), virtual_cursor_x is preserved, but not virtual_cursor_y
  126.    * In case b), both virtual_cursor_x and virtual_cursor_y are preserved.
  127.    */
  128.   gint virtual_cursor_x;           /* -1 means use actual cursor position */
  129.   gint virtual_cursor_y;           /* -1 means use actual cursor position */
  130.  
  131.   GtkTextMark *first_para_mark;    /* Mark at the beginning of the first onscreen paragraph */
  132.   gint first_para_pixels;          /* Offset of top of screen in the first onscreen paragraph */
  133.  
  134.   GtkTextMark *dnd_mark;
  135.   guint blink_timeout;
  136.  
  137.   guint first_validate_idle;            /* Idle to revalidate onscreen portion, runs before resize */
  138.   guint incremental_validate_idle;      /* Idle to revalidate offscreen portions, runs after redraw */
  139.  
  140.   GtkIMContext *im_context;
  141.   GtkWidget *popup_menu;
  142.  
  143.   gint drag_start_x;
  144.   gint drag_start_y;
  145.  
  146.   GSList *children;
  147.  
  148.   GtkTextPendingScroll *pending_scroll;
  149.  
  150.   gint pending_place_cursor_button;
  151. };
  152.  
  153. struct _GtkTextViewClass
  154. {
  155.   GtkContainerClass parent_class;
  156.  
  157.   void (* set_scroll_adjustments)   (GtkTextView    *text_view,
  158.                                      GtkAdjustment  *hadjustment,
  159.                                      GtkAdjustment  *vadjustment);
  160.  
  161.   void (* populate_popup)           (GtkTextView    *text_view,
  162.                                      GtkMenu        *menu);
  163.   
  164.   /* These are all RUN_ACTION signals for keybindings */
  165.  
  166.   /* move insertion point */
  167.   void (* move_cursor) (GtkTextView    *text_view,
  168.                         GtkMovementStep step,
  169.                         gint            count,
  170.                         gboolean        extend_selection);
  171.  
  172.   /* FIXME should be deprecated in favor of adding GTK_MOVEMENT_HORIZONTAL_PAGES
  173.    * or something in GTK 2.2, was put in to avoid adding enum values during
  174.    * the freeze.
  175.    */
  176.   void (* page_horizontally) (GtkTextView *text_view,
  177.                               gint         count,
  178.                               gboolean     extend_selection);
  179.   
  180.   /* move the "anchor" (what Emacs calls the mark) to the cursor position */
  181.   void (* set_anchor)  (GtkTextView    *text_view);
  182.  
  183.   /* Edits */
  184.   void (* insert_at_cursor)      (GtkTextView *text_view,
  185.                                   const gchar *str);
  186.   void (* delete_from_cursor)    (GtkTextView  *text_view,
  187.                                   GtkDeleteType type,
  188.                                   gint          count);
  189.   void (* backspace)             (GtkTextView *text_view);
  190.  
  191.   /* cut copy paste */
  192.   void (* cut_clipboard)   (GtkTextView *text_view);
  193.   void (* copy_clipboard)  (GtkTextView *text_view);
  194.   void (* paste_clipboard) (GtkTextView *text_view);
  195.   /* overwrite */
  196.   void (* toggle_overwrite) (GtkTextView *text_view);
  197.  
  198.   /* propagates to GtkWindow move_focus */
  199.   void (* move_focus)       (GtkTextView     *text_view,
  200.                              GtkDirectionType direction);  
  201.   
  202.   
  203.   /* Padding for future expansion */
  204.   void (*_gtk_reserved1) (void);
  205.   void (*_gtk_reserved2) (void);
  206.   void (*_gtk_reserved3) (void);
  207.   void (*_gtk_reserved4) (void);
  208.   void (*_gtk_reserved5) (void);
  209.   void (*_gtk_reserved6) (void);
  210.   void (*_gtk_reserved7) (void);
  211. };
  212.  
  213. GType          gtk_text_view_get_type              (void) G_GNUC_CONST;
  214. GtkWidget *    gtk_text_view_new                   (void);
  215. GtkWidget *    gtk_text_view_new_with_buffer       (GtkTextBuffer *buffer);
  216. void           gtk_text_view_set_buffer            (GtkTextView   *text_view,
  217.                                                     GtkTextBuffer *buffer);
  218. GtkTextBuffer *gtk_text_view_get_buffer            (GtkTextView   *text_view);
  219. gboolean       gtk_text_view_scroll_to_iter        (GtkTextView   *text_view,
  220.                                                     GtkTextIter   *iter,
  221.                                                     gdouble        within_margin,
  222.                                                     gboolean       use_align,
  223.                                                     gdouble        xalign,
  224.                                                     gdouble        yalign);
  225. void           gtk_text_view_scroll_to_mark        (GtkTextView   *text_view,
  226.                                                     GtkTextMark   *mark,
  227.                                                     gdouble        within_margin,
  228.                                                     gboolean       use_align,
  229.                                                     gdouble        xalign,
  230.                                                     gdouble        yalign);
  231. void           gtk_text_view_scroll_mark_onscreen  (GtkTextView   *text_view,
  232.                                                     GtkTextMark   *mark);
  233. gboolean       gtk_text_view_move_mark_onscreen    (GtkTextView   *text_view,
  234.                                                     GtkTextMark   *mark);
  235. gboolean       gtk_text_view_place_cursor_onscreen (GtkTextView   *text_view);
  236.  
  237. void           gtk_text_view_get_visible_rect      (GtkTextView   *text_view,
  238.                                                     GdkRectangle  *visible_rect);
  239. void           gtk_text_view_set_cursor_visible    (GtkTextView   *text_view,
  240.                                                     gboolean       setting);
  241. gboolean       gtk_text_view_get_cursor_visible    (GtkTextView   *text_view);
  242.  
  243. void           gtk_text_view_get_iter_location     (GtkTextView   *text_view,
  244.                                                     const GtkTextIter *iter,
  245.                                                     GdkRectangle  *location);
  246. void           gtk_text_view_get_iter_at_location  (GtkTextView   *text_view,
  247.                                                     GtkTextIter   *iter,
  248.                                                     gint           x,
  249.                                                     gint           y);
  250. void           gtk_text_view_get_iter_at_position  (GtkTextView   *text_view,
  251.                                                     GtkTextIter   *iter,
  252.                             gint          *trailing,
  253.                                                     gint           x,
  254.                                                     gint           y);
  255. void           gtk_text_view_get_line_yrange       (GtkTextView       *text_view,
  256.                                                     const GtkTextIter *iter,
  257.                                                     gint              *y,
  258.                                                     gint              *height);
  259.  
  260. void           gtk_text_view_get_line_at_y         (GtkTextView       *text_view,
  261.                                                     GtkTextIter       *target_iter,
  262.                                                     gint               y,
  263.                                                     gint              *line_top);
  264.  
  265. void gtk_text_view_buffer_to_window_coords (GtkTextView       *text_view,
  266.                                             GtkTextWindowType  win,
  267.                                             gint               buffer_x,
  268.                                             gint               buffer_y,
  269.                                             gint              *window_x,
  270.                                             gint              *window_y);
  271. void gtk_text_view_window_to_buffer_coords (GtkTextView       *text_view,
  272.                                             GtkTextWindowType  win,
  273.                                             gint               window_x,
  274.                                             gint               window_y,
  275.                                             gint              *buffer_x,
  276.                                             gint              *buffer_y);
  277.  
  278. GdkWindow*        gtk_text_view_get_window      (GtkTextView       *text_view,
  279.                                                  GtkTextWindowType  win);
  280. GtkTextWindowType gtk_text_view_get_window_type (GtkTextView       *text_view,
  281.                                                  GdkWindow         *window);
  282.  
  283. void gtk_text_view_set_border_window_size (GtkTextView       *text_view,
  284.                                            GtkTextWindowType  type,
  285.                                            gint               size);
  286. gint gtk_text_view_get_border_window_size (GtkTextView       *text_view,
  287.                        GtkTextWindowType  type);
  288.  
  289. gboolean gtk_text_view_forward_display_line           (GtkTextView       *text_view,
  290.                                                        GtkTextIter       *iter);
  291. gboolean gtk_text_view_backward_display_line          (GtkTextView       *text_view,
  292.                                                        GtkTextIter       *iter);
  293. gboolean gtk_text_view_forward_display_line_end       (GtkTextView       *text_view,
  294.                                                        GtkTextIter       *iter);
  295. gboolean gtk_text_view_backward_display_line_start    (GtkTextView       *text_view,
  296.                                                        GtkTextIter       *iter);
  297. gboolean gtk_text_view_starts_display_line            (GtkTextView       *text_view,
  298.                                                        const GtkTextIter *iter);
  299. gboolean gtk_text_view_move_visually                  (GtkTextView       *text_view,
  300.                                                        GtkTextIter       *iter,
  301.                                                        gint               count);
  302.  
  303. /* Adding child widgets */
  304. void gtk_text_view_add_child_at_anchor (GtkTextView          *text_view,
  305.                                         GtkWidget            *child,
  306.                                         GtkTextChildAnchor   *anchor);
  307.  
  308. void gtk_text_view_add_child_in_window (GtkTextView          *text_view,
  309.                                         GtkWidget            *child,
  310.                                         GtkTextWindowType     which_window,
  311.                                         /* window coordinates */
  312.                                         gint                  xpos,
  313.                                         gint                  ypos);
  314.  
  315. void gtk_text_view_move_child          (GtkTextView          *text_view,
  316.                                         GtkWidget            *child,
  317.                                         /* window coordinates */
  318.                                         gint                  xpos,
  319.                                         gint                  ypos);
  320.  
  321. /* Default style settings (fallbacks if no tag affects the property) */
  322.  
  323. void             gtk_text_view_set_wrap_mode          (GtkTextView      *text_view,
  324.                                                        GtkWrapMode       wrap_mode);
  325. GtkWrapMode      gtk_text_view_get_wrap_mode          (GtkTextView      *text_view);
  326. void             gtk_text_view_set_editable           (GtkTextView      *text_view,
  327.                                                        gboolean          setting);
  328. gboolean         gtk_text_view_get_editable           (GtkTextView      *text_view);
  329. void             gtk_text_view_set_overwrite          (GtkTextView      *text_view,
  330.                                gboolean          overwrite);
  331. gboolean         gtk_text_view_get_overwrite          (GtkTextView      *text_view);
  332. void         gtk_text_view_set_accepts_tab        (GtkTextView    *text_view,
  333.                                gboolean         accepts_tab);
  334. gboolean     gtk_text_view_get_accepts_tab        (GtkTextView    *text_view);
  335. void             gtk_text_view_set_pixels_above_lines (GtkTextView      *text_view,
  336.                                                        gint              pixels_above_lines);
  337. gint             gtk_text_view_get_pixels_above_lines (GtkTextView      *text_view);
  338. void             gtk_text_view_set_pixels_below_lines (GtkTextView      *text_view,
  339.                                                        gint              pixels_below_lines);
  340. gint             gtk_text_view_get_pixels_below_lines (GtkTextView      *text_view);
  341. void             gtk_text_view_set_pixels_inside_wrap (GtkTextView      *text_view,
  342.                                                        gint              pixels_inside_wrap);
  343. gint             gtk_text_view_get_pixels_inside_wrap (GtkTextView      *text_view);
  344. void             gtk_text_view_set_justification      (GtkTextView      *text_view,
  345.                                                        GtkJustification  justification);
  346. GtkJustification gtk_text_view_get_justification      (GtkTextView      *text_view);
  347. void             gtk_text_view_set_left_margin        (GtkTextView      *text_view,
  348.                                                        gint              left_margin);
  349. gint             gtk_text_view_get_left_margin        (GtkTextView      *text_view);
  350. void             gtk_text_view_set_right_margin       (GtkTextView      *text_view,
  351.                                                        gint              right_margin);
  352. gint             gtk_text_view_get_right_margin       (GtkTextView      *text_view);
  353. void             gtk_text_view_set_indent             (GtkTextView      *text_view,
  354.                                                        gint              indent);
  355. gint             gtk_text_view_get_indent             (GtkTextView      *text_view);
  356. void             gtk_text_view_set_tabs               (GtkTextView      *text_view,
  357.                                                        PangoTabArray    *tabs);
  358. PangoTabArray*   gtk_text_view_get_tabs               (GtkTextView      *text_view);
  359.  
  360. /* note that the return value of this changes with the theme */
  361. GtkTextAttributes* gtk_text_view_get_default_attributes (GtkTextView    *text_view);
  362.  
  363. G_END_DECLS
  364.  
  365. #endif /* __GTK_TEXT_VIEW_H__ */
  366.